package com.esfak47.mediafetcher.core.service;

import com.esfak47.common.PageResult;
import com.esfak47.common.extension.Adaptive;
import com.esfak47.common.extension.ExtensionLoader;
import com.esfak47.common.extension.SPI;
import com.esfak47.mediafetcher.core.domain.Media;

import java.util.Set;

/**
 * @author tony
 */

@SPI
public interface MediaProvider {

    default Set<String> getAllTypes() {
        return ExtensionLoader.getExtensionLoader(MediaProvider.class).getSupportedExtensions();
    }

    @Adaptive(value = "protocol")
    PageResult<Media> provide(ProvideQuery query);

    enum OrderType {
        //not care
        nc("not care"),
        //most recent
        mr("most recent"),
        //most viewed
        mv("Most viewed");
        String desc;

        OrderType(String desc) {this.desc = desc;}
    }

}
